using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.Data.SqlClient;
using Marlimer.Common;

namespace Marlimer.Data.Historico
{
    public class his_AnalisisVenta
    {
        public DataTable getConsultaAnalisisVenta(DateTime dfec_ini, DateTime dfec_fin)
        {
            SqlCommand sqlcmd = new SqlCommand();
            SqlDataAdapter da = new SqlDataAdapter();
            DataSet ds = new DataSet();

            sqlcmd.CommandText = "sprConsultaAnalisisVenta";
            sqlcmd.CommandType = CommandType.StoredProcedure;
            sqlcmd.Connection = Session.getConexion();

            sqlcmd.Parameters.Add("@dfec_ini", SqlDbType.DateTime);
            sqlcmd.Parameters.Add("@dfec_fin", SqlDbType.DateTime);

            sqlcmd.Parameters["@dfec_ini"].Value = dfec_ini;
            sqlcmd.Parameters["@dfec_fin"].Value = dfec_fin;

            da.SelectCommand = sqlcmd;
            da.Fill(ds);

            return ds.Tables[0];
        }

        public DataTable getConsultaAvancesVenta(DateTime dfec_ini, DateTime dfec_fin)
        {
            SqlCommand sqlcmd = new SqlCommand();
            SqlDataAdapter da = new SqlDataAdapter();
            DataSet ds = new DataSet();

            sqlcmd.CommandText = "sprConsultaAvanceVentas";
            sqlcmd.CommandType = CommandType.StoredProcedure;
            sqlcmd.Connection = Session.getConexion();

            sqlcmd.Parameters.Add("@dfec_ini", SqlDbType.DateTime);
            sqlcmd.Parameters.Add("@dfec_fin", SqlDbType.DateTime);

            sqlcmd.Parameters["@dfec_ini"].Value = dfec_ini;
            sqlcmd.Parameters["@dfec_fin"].Value = dfec_fin;

            da.SelectCommand = sqlcmd;
            da.Fill(ds);

            return ds.Tables[0];
        }
    }
}
